# 新建 damage.gd
class_name Damage
extends Resource
## 伤害数据容器

var base_value: float = 0.0 ## 基础伤害值
var source: Unit = null ## 伤害来源单位
var critical: bool = false ## 是否暴击
var damage_type: int = GameConstant.DAMAGE_TYPE.PHYSICAL ## 伤害类型枚举值

var final_value: float: ## 最终伤害值
	get: return round(base_value * (1.5 if critical else 1.0))


func _init(value: float, type: int, src: Unit, crit: bool = false):
	base_value = value
	damage_type = type
	source = src
	critical = crit
